using Habanero.Faces.Base;
using Habanero.Faces.Win;

namespace FireStarterModeller.UI
{
    /// <summary>
    /// Lists the available projects that can be generated
    /// </summary>
    public enum ProjectNames
    {
        BO_Project_Name,
        Logic_Project_Name,
        UI_Base_Project_Name,
        UI_Win_Project_Name,
        UI_VWG_Project_Name,
        Win_Project_Name,
        VWG_Project_Name,
        Test_BO_Project_Name
    }

    /// <summary>
    /// Provides a control to edit the names used to generate
    /// different projects in a solution and provides a checkbox
    /// that allows a developer to indicate which projects they
    /// want to generate.
    /// </summary>
    public class ProjectNameControl : UserControlWin
    {
        private ILabel _label;
        private ICheckBox _checkBox;
        private ITextBox _textBox;

        public ProjectNameControl(ProjectNames projectName)
        {
            IControlFactory controlFactory = GlobalUIRegistry.ControlFactory;
            _label = controlFactory.CreateLabel();
            _label.Width = 200;
            _label.Text = projectName.ToString().Replace("_", " ");
            _textBox = controlFactory.CreateTextBox();
            _checkBox = controlFactory.CreateCheckBox();

            _textBox.Enabled = false;

            _checkBox.CheckedChanged += CheckBox_CheckedChanged;
            FlowLayoutManager flowLayoutManager = new FlowLayoutManager(this, controlFactory);
            flowLayoutManager.AddControl(_label);
            flowLayoutManager.AddControl(_textBox);
            flowLayoutManager.AddControl(_checkBox);
        }

        private void CheckBox_CheckedChanged(object sender, System.EventArgs e)
        {
            _textBox.Enabled = _checkBox.Checked;
        }

        public ILabel Label
        {
            get { return _label; }
        }

        public ICheckBox CheckBox
        {
            get { return _checkBox; }
        }

        public ITextBox TextBox
        {
            get { return _textBox; }
        }
    }
}